package passworks.GraphicGates;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import passworks.ImageBase;
import passworks.DisplayBase;
import passworks.Gates.Switch;


public class GraphicSwitch extends DisplayBase {

    private Switch myGate;
    private Image myOnImage;
    
    
    public GraphicSwitch(Point coord, Switch gate) {
        this.coord = coord;
        myGate = gate;
        this.ID = gate.ownID;

        this.myImage = ImageBase.SwitchOff;
        this.myOnImage = ImageBase.SwitchOn;
    }

    @Override
    public int GetWidth()
    {
        return 19;
    }

    @Override
    public int GetHeight()
    {
        return 19;
    }

    @Override
    public void Action(){
        myGate.NextState();
    }
    
    @Override
    public void Draw(Graphics g) {
        if(myGate.GetCurrentValue()) {
            g.drawImage(myOnImage, coord.x, coord.y, null);
        } else {
            g.drawImage(myImage, coord.x, coord.y, null);
        }
    }

}
